// 连接数据库
// 引入mongoose
const mongoose = require('mongoose');
// 获取配置环境配置信息
const config = require('config').get('db');

mongoose.connect(`mongodb://${config.user}:${config.pwd}@${config.host}:${config.port}/${config.name}`, {
        useUnifiedTopology: true,
        useNewUrlParser: true,
        useCreateIndex: true

    })
    .then(() => console.log('数据库连接成功'))
    .catch(() => console.log('数据库连接失败'));